/**
 * Dear programmer:
 * When I wrote this code, only god and I knew how it worked.
 * Now, only god knows it!
 *
 * @author: Pegasus  Date: 2018/8/28 Time: 00:01
 */

import {createStore, applyMiddleware, combineReducers} from 'redux';
import thunkMiddleware from 'redux-thunk';
import {composeWithDevTools} from 'redux-devtools-extension';

import {navState} from "./Reducer"
import {onShowDemoValue} from "../demo/Reduces"
import {onMessage} from "../component/Message/_Reducer"
import {onLogin,onGetCache,onOffWork,onWHSKMenuMain,onCreateFtpTimer,onAlinarg,onButtonRight} from "../screen/login/LoginScreen/Reducers"
import {onToken,onCache,onUserSession} from "../screen/login/AuthScreen/Reducer"
import {onGetDs,onGetDs_R,onDepartRepairOrderGetStatus,onDepartRepairOrderGetRole,onDepartRepairOrderGetArea} from "../screen/job/WorkOrder/DepartmentalRepairOrderScreen/Reducers"
import {onCreateRepairWorkOrder} from "../screen/job/WorkOrder/CreateRepairWorkOrderScreen/Reducers"
import {onDepartRepairOrderDetailDefault,onDealPeople,onChangeOrderRemark} from "../screen/job/WorkOrder/DepartmentalRepairOrderScreen/DepartmentalRepairOrderDetailScreen/Reducers"
import {onPersonnelStatus} from "../screen/job/EngineeringManagement/PersonnelStatusScreen/Reduces"
import {onPersonnelStatus_Filters,onGetRoomService} from "../screen/job/EngineeringManagement/PersonnelStatusScreen/FiltersScreen/Reduces"
import {onRetrieveCacheData} from "../screen/report/_Reduces"
import {onRepairRecordNewDefault} from "../screen/job/WorkOrder/CreateRepairWorkOrderScreen/Reducers"
import {onChangeOrder} from "../component/OrderDetailComponent/Reducers"
import {onChangeSweepOrderStatus,onRetrieveWHSKAlinusers} from "../component/BottomButtonView/Reducers"
import {onOrderChangeStateMsg} from "../screen/job/WorkOrder/DepartmentalRepairOrderScreen/DepartmentalRepairOrderDetailScreen/InputReason/Reducers"
import {onGetRecordSum,onMaterialRecordOut,onRetrieveMaterialBySn} from "../screen/job/WorkOrder/DepartmentalRepairOrderScreen/DepartmentalRepairOrderDetailScreen/Consumables/Reducers"
import {onRetrieveMaterial} from "../screen/job/WorkOrder/RepairWorkOrderChooseConsumablesScreen/Reducers"
import {onGetRecordSummary} from "../screen/job/JobScreen/Reducers"
import {onRetrieveRoomsView,onReservationDefault,onRetrieveFtpCustom} from "../screen/RoomDisk/RoomDiskScreen/Reducers"
import {onIMOrder} from "../screen/job/EngineeringManagement/InstantMaintenanceOrderScreen/Reducers"
import {onQmsMaterialAdd,onQmsMaterialNewDefault,onQmsMaterialEdit} from "../screen/job/EngineeringManagement/QmsMaterial/Reducers"
import {onChangePassword} from "../screen/mine/ChangePassword/Reducers"
import {onOrderSweep} from "../screen/Housekeeper/roomCleanScreen/Reducers"
import {onLinenAndBar,onLinen_save,onBar_save} from "../screen/Housekeeper/addLinenAndBar/Reducers"
import {onCheckUnusual} from "../screen/Housekeeper/addCheckUnusual/Reducers"
import {onRetrieveRoomMSG,onRetrieveRoomMSGByRoom,onRetrieveRoommates,onRetrieveGuestLedger,onGetScurryDefault,onSetRoomOOOS,onRetrieveroomooos,onHoLoseAdd,onRetrieveHoLose,onRetrieveLogRecord,onHousekeepingSweepSetStatus,onSaveScurryOrder,onGetWHSKDict,onSaveRoomClean,onSaveSearchMiss,onSaveGuestService,onSaveGoodsService} from "../screen/RoomDisk/RoomStatus/Reducers"
import {onOrderScreenDs,onOrderSweepSave,onOrderCheckOutSave} from "../screen/Housekeeper/orderScreen/Actions"
import {onRetrieveOrderDetail} from "../screen/Housekeeper/showOrderDetail/Actions"
import {onRetrieveRoomViewAs} from "../screen/Housekeeper/retrieveRoomsView/Actions"
import {onWHSKAlinusers} from "../screen/Housekeeper/retrieveWHSKAlinusers/Actions"
import {onRetrieveWhskShiftsSetup,onRetrieveWhskShifts,onWHSKShiftsSetupAdd,onWHSKShiftsArrangeDefault,onShiftsArrangeAdd,onShiftsArrangeEdit,onShiftsArrangeDel} from "../screen/discover/staffSchedule/Actions"
import {onDailyOrderSweepDefault,onRetrieveRoomsViewAs,onDailyOrderSweepSave} from "../screen/discover/assignRoom/Actions"
import {onRetrieveRoomChangeReport,onRetrieveRoomHistory} from "../screen/report/Report/Actions"

const rootReducer = combineReducers({
  navState,

  onShowDemoValue, //

  onMessage,
  onToken, // token

  onLogin, // 登录
  onRetrieveCacheData, // 本地缓存数据

  onGetDs,//我的工单=>部门报修单(数据源)

  onGetDs_R,//即时工单=>房务

  onDepartRepairOrderGetStatus,//我的工单=>部门报修单(状态选择)

  onDepartRepairOrderGetRole,//我的工单=>部门报修单(工种选择)

  onDepartRepairOrderGetArea,//我的工单=>部门报修单(区域选择)

  onDepartRepairOrderDetailDefault,//我的工单=>部门报修单=>详细信息(数据源)

  onCreateRepairWorkOrder,//我的工单=>新建部门报修单

  onUserSession,//登录用户Session

  onCache,//登陆用户缓存数据

  onGetCache,//登录获取缓存数据

  onAlinarg,//酒店参数

  onButtonRight,

  //工程管理=>人员状态(job=>PersonnelStatusScreen)
  onPersonnelStatus,
  //工程管理=>人员状态=>筛选(job=>PersonnelStatusScreen=>FiltersScreen)
  onPersonnelStatus_Filters,
  //工程管理=>未派工程单(选择处理人)
  onDealPeople,

  onChangeOrderRemark,//工单备注修改

  onRepairRecordNewDefault, // 获取新建维修单默认参数

  onChangeOrder, //工单操作

  onOrderChangeStateMsg,//工单操作 （删除，挂机，完成）

  onGetRecordSum,//获取当前耗材记录

  onRetrieveMaterial, //获取耗材列表

  onMaterialRecordOut, //完成耗材添加

  onRetrieveMaterialBySn, //获取耗材信息By（Sn）

  onGetRecordSummary,//获取即时维修单状态

  onRetrieveRoomsView,//获取房态盘信息

  onReservationDefault,//获取房态盘不显示图标合集
  onRetrieveFtpCustom,

  onGetRoomService,//获取房务列表

  onIMOrder,//即时维修单数据源

  onQmsMaterialNewDefault,//耗材设置新增默认值

  onQmsMaterialAdd,//新增耗材

  onQmsMaterialEdit,//修改耗材

  onOffWork,//下班

  onWHSKMenuMain,onCreateFtpTimer,

  onChangePassword,//修改密码

  onOrderSweep,//客房清洁

  onLinenAndBar,//布草易耗品

  onCheckUnusual,//布草易耗品

  onLinen_save,//布草保存

  onBar_save,//酒水保存

  onRetrieveRoomMSG,//获取房间信息

  onRetrieveRoomMSGByRoom,onRetrieveRoommates,onRetrieveGuestLedger,//获取房间信息

  onGetScurryDefault,//获取赶房清洁人查房人默认信息

  onSetRoomOOOS,

  onRetrieveLogRecord,

  onRetrieveHoLose,

  onHoLoseAdd,

  onRetrieveroomooos,

  onHousekeepingSweepSetStatus,

  onSaveScurryOrder,//新建赶房工单

  onGetWHSKDict,//获取服务物品菜单

  onSaveRoomClean,//新建住房打扫

  onSaveSearchMiss,//遗留查找

  onSaveGuestService,//客人催服务

  onSaveGoodsService,//物品/服务

  onChangeSweepOrderStatus,//修改清洁工单状态

  onRetrieveWHSKAlinusers,//获取员工表

  onOrderScreenDs,//我的工单

  onOrderSweepSave,//领取任务

  onOrderCheckOutSave,//新建退房检查

  onRetrieveOrderDetail,//获取订单详情

  onRetrieveRoomViewAs,//获取房间数据

  onWHSKAlinusers,

  onRetrieveWhskShiftsSetup,//获取班次时间表

  onRetrieveWhskShifts,//获取值班人员

  onWHSKShiftsSetupAdd,//班次添加

  onWHSKShiftsArrangeDefault,//添加值班人员默认值

  onShiftsArrangeAdd,//保存值班人员

  onShiftsArrangeEdit,//修改值班人员~

  onShiftsArrangeDel,//删除值班人员

  onDailyOrderSweepDefault,//每日分配默认值

  onRetrieveRoomsViewAs,onDailyOrderSweepSave,//每日分配房态盘默认值

  onRetrieveRoomChangeReport,onRetrieveRoomHistory,//获取换房报表
});

// let createStoreWithMiddleware = applyMiddleware(thunkMiddleware)(createStore);
// let store = createStoreWithMiddleware(rootReducer);

const composeEnhancers = composeWithDevTools({});
const store = createStore(rootReducer, composeEnhancers(
  applyMiddleware(thunkMiddleware),
));

export const getStore = () => {
  return store;
};